package com.github.lee.unsplash.model.repository

import com.github.lee.unsplash.model.api.PhotoApi
import com.github.unsplash.repository.repository.ParamContentFilter
import com.github.unsplash.repository.repository.ParamOrientation
import com.github.unsplash.repository.repository.ParamPhotoOrderBy
import retrofit2.http.POST
import retrofit2.http.Path
import java.util.*
import javax.inject.Inject

class PhotoRepository @Inject constructor(private val api: PhotoApi) {


    suspend fun listPhotos(
        page: Int,
        size: Int? = 10,
        orderBy: ParamPhotoOrderBy? = ParamPhotoOrderBy.POPULAR
    ) = api.listPhotos(page, size, orderBy?.toString()?.toLowerCase(Locale.ROOT))

    suspend fun randomOnePhoto(
        collections: String? = null,
        username: String? = null,
        orientation: ParamOrientation? = null,
        contentFilter: ParamContentFilter? = null
    ) = api.randomOnePhoto(
        collections,
        username,
        orientation?.toString()?.toLowerCase(Locale.ROOT),
        contentFilter?.toString()?.toLowerCase(Locale.ROOT),
    )


    suspend fun likePhoto(id: String) =
        api.likePhoto(id)

    suspend fun unlikePhoto(id: String) =
        api.unlikePhoto(id)

}